<?php
include_once '../classes/HTML.php';
include_once '../classes/Authentication.php';
$auth = new Authentication ();

if (isset ( $_POST ['submit'] )) {
	if (isset ( $_POST ['source'] )) {
		session_start ();
		$auth->signin ( $_POST ['source'] );
	} else {
		session_start ();
		$auth->signin ();
	}
}
HTML::createHeader ( 'SysVentory Anmelden', 'signin.css' );
?>
<body>
	<div class="container">
	<?php HTML::noScript();?>
      <form class="form-signin"
			action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
			<h2 class="form-signin-heading">Bitte Anmelden</h2>
        	<?php		
				if (isset ( $_GET ['source'] )) {
					echo '<input type="hidden" name="source" value="' . $_GET ['source'] . '">';
				}
			?>
	        <input type="email" class="form-control" placeholder="Email adresse" name="email" required autofocus>
	        <input type="password" class="form-control" placeholder="Passwort" name="password" required>
			<button class="btn btn-lg btn-primary btn-block" type="submit" name="submit">Anmelden</button>
		</form>
      <?php HTML::createFooter();?>
    </div>
	<!-- /container -->
	
<?php HTML::includeJS();?>
  </body>
</html>
